const path = require('path')
const resolve = dir => path.join(__dirname, dir)

module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? '/iview-admin' : '/',
  chainWebpack: config => {
    config.resolve.alias
      .set('@', resolve('src'))
      .set('_c', resolve('src/components'))
  },
  productionSourceMap: false,
  devServer: {
    proxy: {
      '/api': {
        target: 'http://mall-pre.springboot.cn',
        ws: true,
        changeOrigin: true,
        // logLevel: 'debug',
        pathRewrite: {
          '/api': '/',
        },
      },
    },
  },
  // css: {
  //   loaderOptions: {
  //     // 给 sass-loader 传递选项
  //     sass: {
  //       prependData: `@import "./src/assets/css/variables.scss";`,
  //     },
  //   },
  // },
}
